import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:sp_util/sp_util.dart';
import 'package:yp/Xwidgets/cache_image.dart';
import 'package:yp/config/config.dart';
import 'package:yp/config/event_bus.dart';
import 'package:yp/helper.dart';
import 'package:yp/router.dart';

import 'logic.dart';
import 'scroll_to_item.dart';
import 'state.dart';

class ClassificationPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _ClassificationPage();
  }
}

class _ClassificationPage extends State<ClassificationPage> {
  final ClassificationLogic logic = Get.put(ClassificationLogic());
  final ClassificationState state = Get.find<ClassificationLogic>().state;
  final ScrollToIndexController _scrollToIndexController =
      ScrollToIndexController();

  @override
  void initState() {
    super.initState();

    eventBus.on<SwitchTabEvent>().listen((event) {
      // _setPlayList();

      print("SwitchTabEvent = ${event.linktarget}");
      for (var i = 0; i < state.categoryList.length; i++) {
        if (state.categoryList[i]["child_list"] != null) {
          for (var m = 0; m < state.categoryList[i]["child_list"].length; m++) {
            if (state.categoryList[i]["child_list"][m]["cat_id"] ==
                event.linktarget) {
              print("SwitchTabEvent = ${event.linktarget}--index= $i");
              state.level1ChooseIndex = i;
              logic.update();
              logic.requestGoodsList(1);
              break;
            }
          }
        }
      }
    });

    logic.requestGoodsCategories();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: Color(0xffEA5504),
        elevation: 0,
        title: Image.asset(
          'assets/images/logoMain.png',
          height: 22,
          fit: BoxFit.fitHeight,
        ),
      ),
      body: GetBuilder<ClassificationLogic>(
        builder: (logic) {
          return Container(
            color: Colors.white,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [//分类页
                _searchLayout(),//搜索框
                Expanded(//页面
                  child: Row(
                    children: [
                      _level1CategoryList(),
                      _contentLayout(),
                    ],
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }

  Widget _searchLayout() {
    return Container(
      height: setWidth(90),
      decoration: BoxDecoration(
        border: Border(
          bottom: BorderSide(
            color: Color(0x40000000),
            width: setWidth(1),
          ),
        ),
      ),
      padding: EdgeInsets.only(
        left: setWidth(30),
        top: setWidth(22),
        right: setWidth(30),
        bottom: setWidth(14),
      ),
      child: InkWell(
        onTap: () {
          Get.toNamed(RouteConfig.commoditySearch);
        },
        child: Container(
          height: setWidth(54),
          decoration: BoxDecoration(
            color: Color(0xfff3f4f6),
            borderRadius: BorderRadius.circular(setWidth(54)),
          ),
          padding: EdgeInsets.only(
            left: setWidth(24),
          ),
          child: Row(
            children: [
              Icon(
                Icons.search,
                size: setWidth(24),
                color: Color(0xffcccccc),
              ),
              SizedBox(
                width: setWidth(14),
              ),
              Text(
                '请输入店内商品名称',
                style: TextStyle(
                  color: Color(0xffcccccc),
                  fontSize: 12,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  // 类别列表
  Widget _level1CategoryList() {
    return Container(
      width: setWidth(160),
      color: Color(0xffF3F4F6),
      child: ListView(
        children: state.categoryList
            .asMap()
            .map((key, value) {
              return MapEntry(key, _leftLevel1CategoryItem(key, value));
            })
            .values
            .toList(),
      ),
    );
  }

  // 商品列表
  Widget _contentLayout() {
    if (state.isUniversalLayout()) {
      return _universalLayout();
    } else {
      return _standardLayout();
    }
  }

  Widget _standardLayout() {
    List categoryList = [];
    if (state.categoryList != null && state.categoryList.isNotEmpty) {
      String bannerUrl = state.categoryList[0]['cat_banner'];
      var categoryJson = {'isBanner': true, 'cat_banner': bannerUrl};
      categoryList.add(categoryJson);
      categoryList.addAll(state.categoryList);
    }
    if (categoryList.isEmpty) {
      return Container();
    }

    return Container(
      width: setWidth(590),
      color: Colors.white,
      child: ScrollToIndex(
        list: categoryList,
        controller: _scrollToIndexController,
        itemBuilder: (context, index) {
          var categoryJson = categoryList[index];

          bool isBanner =
              categoryJson['isBanner'] != null && categoryJson['isBanner'];
          if (isBanner) {
            String bannerUrl = categoryJson['cat_banner'];
            if (bannerUrl == null || bannerUrl.isEmpty) {
              return Container();
            }
            return Container(
              padding: EdgeInsets.only(
                left: setWidth(20),
                top: setWidth(24),
                right: setWidth(20),
              ),
              child: ClipRRect(
                borderRadius: BorderRadius.circular(setWidth(10)),
                child: Image.network(
                  bannerUrl,
                  width: setWidth(550),
                  height: setWidth(176),
                  fit: BoxFit.fill,
                ),
              ),
            );
          }
          return _level12CategoryList(categoryJson);
        },
      ),
    );
  }

  // 类别列表
  Widget _leftLevel1CategoryItem(int index, var category) {
    String categoryName = '';
    if (category != null && category['cat_name'] != null) {
      categoryName = category['cat_name'];
    }

    return InkWell(
      onTap: () {
        if (state.level1ChooseIndex != index) {
          state.level1ChooseIndex = index;
          if (state.isUniversalLayout()) {
            state.setSortType(ClassificationState.sortDefault);
            state.level2ChooseIndex = 0;
            logic.update();
            logic.requestGoodsList(1);
          } else {
            _scrollToIndexController.to(index + 1);
            logic.update();
          }
        }
      },
      child: Stack(
        children: [
          Container(
            width: setWidth(160),
            height: setWidth(112),
            alignment: Alignment.center,
            color: index == state.level1ChooseIndex
                ? Colors.white
                : Colors.transparent,
            child: Text(
              categoryName,
              style: TextStyle(
                color: index == state.level1ChooseIndex
                    ? Color(0xff424242)
                    : Color(0xff7D7D7D),
                fontSize: 12,
              ),
            ),
          ),
          index == state.level1ChooseIndex
              ? Container(
                  width: setWidth(8),
                  height: setWidth(112),
                  color: Color(0xffea5504),
                )
              : SizedBox(),
        ],
      ),
    );
  }

  Widget _level12CategoryList(var categoryJson) {
    var categoryName = "";
    List level2CategoryList = [];
    if (categoryJson != null) {
      if (categoryJson['cat_name'] != null) {
        categoryName = categoryJson['cat_name'];
      }
      if (categoryJson['child_list'] != null) {
        level2CategoryList = categoryJson['child_list'];
      }
    }
    GlobalKey key = categoryJson['globalKey'];
    return Container(
      key: key,
      padding: EdgeInsets.only(
        left: setWidth(20),
        top: setWidth(26),
        right: setWidth(20),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            categoryName,
            style: TextStyle(
              color: Color(0xff222222),
              fontSize: 14,
              fontWeight: FontWeight.bold,
            ),
          ),
          SizedBox(
            height: setWidth(10),
          ),
          Padding(
            padding: EdgeInsets.symmetric(horizontal: setWidth(10)),
            child: Wrap(
              direction: Axis.horizontal,
              spacing: setWidth(40),
              runSpacing: setWidth(30),
              children: level2CategoryList
                  .asMap()
                  .map((key, value) {
                    return MapEntry(key, _level2CategoryGridItem(value));
                  })
                  .values
                  .toList(),
            ),
          ),
        ],
      ),
    );
  }

  Widget _level2CategoryGridItem(var level2CategoryJson) {
    String imgUrl = "";
    String categoryName = "";
    if (level2CategoryJson['cat_logo'] != null) {
      imgUrl = level2CategoryJson['cat_logo'];
    }
    if (level2CategoryJson['cat_name'] != null) {
      categoryName = level2CategoryJson['cat_name'];
    }

    return GestureDetector(
      onTap: () {
        Get.toNamed(RouteConfig.commoditySearchList,
            parameters: {'linktarget': '${level2CategoryJson['cat_id']}'});
      },
      child: Container(
        width: setWidth(150),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.network(
              imgUrl,
              width: setWidth(150),
              height: setWidth(150),
              errorBuilder: (
                context,
                error,
                stackTrace,
              ) {
                return Image.asset(
                  'assets/images/default_goods_logo.jpg',
                  width: setWidth(150),
                  height: setWidth(150),
                  fit: BoxFit.cover,
                );
              },
            ),
            SizedBox(
              height: setWidth(24),
            ),
            Text(
              categoryName,
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                color: Color(0xff262626),
                fontSize: 14,
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget _divider() {
    return Container(
      width: double.infinity,
      height: 1,
      color: const Color(0xFFEFEFEF),
    );
  }

  Widget _universalLayout() {
    return Expanded(
      child: Container(
        padding: EdgeInsets.only(left: 20),
        child: Column(
          children: [
            _sortLayout(), // 排序
            _divider(), // 分割线
            _level2CategoryUniversal(), // 类别
            _divider(), // 分割线
            _goodsListUniversal(),//商品列表
          ],
        ),
      ),
    );
  }

  Widget _sortLayout() {
    return Container(
      padding: EdgeInsets.only(right: 20, top: 20, bottom: 12),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          GestureDetector(
            onTap: () {
              if (!state.isDefaultSortType()) {
                state.setSortType(ClassificationState.sortDefault);
                logic.update();
                logic.requestGoodsList(1);
              }
            },
            child: Text('综合排序',
                style: TextStyle(
                  fontSize: 12,
                  color: state.isDefaultSortType()
                      ? const Color(0xFFEA5504)
                      : const Color(0xFF222222),
                )),
          ),
          GestureDetector(
            onTap: () {
              if (!state.isSoldQuantitySortType()) {
                state.setSortType(ClassificationState.sortSoldQuantity);
                logic.update();
                logic.requestGoodsList(1);
              }
            },
            child: Text('销量排序',
                style: TextStyle(
                  fontSize: 12,
                  color: state.isSoldQuantitySortType()
                      ? const Color(0xFFEA5504)
                      : const Color(0xFF222222),
                )),
          ),
          GestureDetector(
            onTap: () {
              if (!state.isPriceSortType() ||
                  state.sortType == ClassificationState.sortPriceAsc) {
                state.setSortType(ClassificationState.sortPriceDesc);
              } else {
                state.setSortType(ClassificationState.sortPriceAsc);
              }
              logic.update();
              logic.requestGoodsList(1);
            },
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text('价格排序 ',
                    style: TextStyle(
                      fontSize: 12,
                      color: state.isPriceSortType()
                          ? const Color(0xFFEA5504)
                          : const Color(0xFF222222),
                    )),
                Padding(
                  padding: const EdgeInsets.only(top: 3),
                  child: Image.asset(
                    !state.isPriceSortType()
                        ? "assets/images/sort_def.png"
                        : state.sortType == ClassificationState.sortPriceAsc
                            ? "assets/images/sort_asc.png"
                            : "assets/images/sort_desc.png",
                    width: 8,
                    height: 9,
                  ),
                )
              ],
            ),
          ),
          GestureDetector(
            onTap: () {
              if (!state.isOnSaleTimeSortType()) {
                state.setSortType(ClassificationState.sortOnSaleTime);
                logic.update();
                logic.requestGoodsList(1);
              }
            },
            child: Text('上新',
                style: TextStyle(
                  fontSize: 12,
                  color: state.isOnSaleTimeSortType()
                      ? const Color(0xFFEA5504)
                      : const Color(0xFF222222),
                )),
          ),
        ],
      ),
    );
  }

  Widget _level2CategoryUniversal() {
    if (state.categoryList == null ||
        state.categoryList.isEmpty ||
        state.level1ChooseIndex >= state.categoryList.length) {
      return Container();
    }
    var level1Category = state.categoryList[state.level1ChooseIndex];
    List level2List = level1Category['child_list'];
    if (level2List == null || level2List.isEmpty) {
      return Container();
    }
    return Container(
      height: 40,
      margin: EdgeInsets.only(right: 20),
      child: ListView.builder(
          scrollDirection: Axis.horizontal,
          itemCount: level2List.length,
          itemBuilder: (context, index) {
            return _level2CategoryUniversalItem(
                index, level2List[index], (index == level2List.length - 1));
          }),
    );
  }

  Widget _level2CategoryUniversalItem(
      int index, var level2Category, bool isLast) {
    String categoryName = level2Category['cat_name'];
    double marginLeft = index == 0 ? 0.0 : 20.0;
    double marginRight = !isLast ? 0.0 : 20.0;
    var decoration = BoxDecoration(
        border: Border.all(color: const Color(0xFFEA5504)),
        borderRadius: BorderRadius.all(Radius.circular(10)));
    return GestureDetector(
      onTap: () {
        if (index != state.level2ChooseIndex) {
          state.level2ChooseIndex = index;
          logic.update();
          logic.requestGoodsList(1);
        }
      },
      child: Container(
        margin: EdgeInsets.only(
            left: marginLeft, right: marginRight, top: 9, bottom: 11),
        padding: EdgeInsets.symmetric(horizontal: 5),
        decoration: index == state.level2ChooseIndex ? decoration : null,
        child: Text(
          categoryName ?? "",
          style: TextStyle(
            fontSize: 12,
            color: index == state.level2ChooseIndex
                ? const Color(0xFFEA5504)
                : const Color(0xFF999999),
          ),
        ),
      ),
    );
  }

  Widget _goodsListUniversal() {
    int itemNum = state.goodsList == null ? 0 : state.goodsList.length;
    return itemNum == 0
        ? Expanded(
            child: Container(
              child: Center(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Image.asset(
                      'assets/images/nodata.png',
                      width: setWidth(163.5),
                      height: setWidth(123),
                      fit: BoxFit.cover,
                    ),
                    SizedBox(height: setWidth(20)),
                    Text(
                      '暂无商品',
                      style: TextStyle(
                        color: Color(0xffaaaaaa),
                        fontSize: 15,
                      ),
                    ),
                    SizedBox(height: setWidth(60)),
                  ],
                ),
              ),
            ),
          )
        : Expanded(
            child: SmartRefresher(
              enablePullDown: false,
              enablePullUp: true,
              header: WaterDropHeader(),
              footer: CustomFooter(
                builder: (BuildContext context, LoadStatus mode) {
                  Widget body;
                  if (mode == LoadStatus.idle) {
                    body = Text("上拉加载更多");
                  } else if (mode == LoadStatus.loading) {
                    body = CupertinoActivityIndicator();
                  } else if (mode == LoadStatus.failed) {
                    body = Text("加载失败！点击重试！");
                  } else if (mode == LoadStatus.canLoading) {
                    body = Text("释放以加载更多");
                  } else {
                    body = Text("没有更多了");
                  }
                  return Container(
                    height: 55.0,
                    child: Center(child: body),
                  );
                },
              ),
              controller: state.refreshController,
              onLoading: logic.onLoadMoreGoodsList,//加载数据
              child: ListView.builder(
                  itemCount:
                      state.goodsList == null ? 0 : state.goodsList.length,
                  itemBuilder: (context, index) {
                    return _goodsItemUniversal(state.goodsList[index]);
                  }),
            ),
          );
  }

  Widget _goodsItemUniversal(var goodsJson) {
    String priceStr = '', tiShi = '';
    if (goodsJson['is_seckill'] == 1) {
      // 秒杀商品
      priceStr = goodsJson['price'].toString();
    } else if (goodsJson['is_pre_sale'] == 1) {
      priceStr = goodsJson['price'].toString();
    } else {
      if (goodsJson['expect_price'] > 0) {
        priceStr = goodsJson['expect_price'].toString();
        tiShi = '折后';
      } else {
        priceStr = goodsJson['price'].toString();
      }
    }
    List<InlineSpan> _createPriceSpanList() {
      List<InlineSpan> spans = [];
      spans.add(TextSpan(
        text: tiShi.isEmpty ? '' : "$tiShi ",
        style: TextStyle(
          color: Color(0xFFEA5504),
          fontSize: 11,
        ),
      ));
      spans.add(TextSpan(
        text: "¥${parsePrice(priceStr)}",
        style: TextStyle(
            color: Color(0xFFEA5504),
            fontSize: 16,
            fontWeight: FontWeight.w500),
      ));
      spans.add(TextSpan(
        text: "/${goodsJson['unit']}",
        style: TextStyle(color: Color(0xFF999999), fontSize: 15),
      ));
      // // spans.add(TextSpan(
      // //   text: (goodsJson['commission_amount'] != null && goodsJson['commission_amount'] > 0)
      // //       ? ' 赚${goodsJson['commission_amount']}'
      // //       : '',
      // //   style: TextStyle(color: Color(0xffdd2f3e), fontSize: 11),
      // // ));
      // spans.add(TextSpan(
      //   text: (goodsJson['commission_amount'] != null && goodsJson['commission_amount'] > 0)
      //       ? ''
      //   // ' 赚${goodsJson['commission_amount']}'
      //       : '',
      //   style: TextStyle(color: Color(0xffdd2f3e), fontSize: 11),
      // ));
      return spans;
    }

    bool soldOutBool = goodsJson['style_store'] <= 0;

    return GestureDetector(
      onTap: () {
        String itemNumId = goodsJson['default_item_num_id'].toString();
        String styleNumId = goodsJson['style_num_id'].toString();
        String shopId = goodsJson['shop_num_id'].toString();
        String cat1Id = goodsJson['cat1_id'].toString();
        String ecStyleNumId = goodsJson['ec_style_num_id'].toString();
        Get.toNamed(RouteConfig.goodsDetail, arguments: {
          'itemNumId': itemNumId,
          'styleNumId': styleNumId,
          'shopId': shopId,
          'cat1Id': cat1Id,
          'ecStyleNumId': ecStyleNumId,
        });
      },
      child: Container(
          width: double.infinity,
          height: 116,
          child: Stack(
            children: [
              Padding(
                padding: EdgeInsets.only(left: 20, top: 8),
                child: Stack(
                  children: [
                    CachedImage(
                      width: 100,
                      height: 100,
                      path: goodsJson['image_default_id'] ?? '',
                      scale: BoxFit.fill,
                    ),
                    Positioned(
                      left: 20,
                      top: 20,
                      child: soldOutBool
                          ? Container(
                              width: 60,
                              height: 60,
                              alignment: Alignment.center,
                              decoration: BoxDecoration(
                                color: Color(0xffbbbbbb).withOpacity(0.7),
                                borderRadius:
                                    BorderRadius.circular(setWidth(60)),
                              ),
                              child: Text(
                                '售罄',
                                style: TextStyle(
                                  color: Colors.white,
                                  fontSize: 15,
                                ),
                              ),
                            )
                          : SizedBox(),
                    ),
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(left: 130, top: 10, right: 22),
                child: Text(
                  goodsJson['title'],
                  maxLines: 2,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                      color: const Color(0xFF222222),
                      fontSize: 14,
                      fontWeight: FontWeight.w500),
                ),
              ),
              if (goodsJson['is_seckill'] == 1)
                Padding(
                  padding: const EdgeInsets.only(left: 130, top: 50, right: 22),
                  child: Container(
                    constraints: BoxConstraints(
                      maxWidth: setWidth(220),
                      minWidth: 0,
                    ),
                    height: setWidth(26),
                    padding: EdgeInsets.symmetric(horizontal: setWidth(4)),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(setWidth(4)),
                      border: Border.all(
                        width: setWidth(1),
                        color: Colors.red,
                      ),
                    ),
                    child: Text(
                      "秒杀",
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(
                        color: Colors.red,
                        fontSize: 18.sp,
                        height: 1.3,
                      ),
                    ),
                  ),
                ),
              /**/
              // Align(
              //   alignment: Alignment.bottomRight,
              //   child: GestureDetector(
              //     onTap: () {
              //       if (SpUtil.getString('token') == null || SpUtil.getString('token') == '') {
              //         Get.toNamed(RouteConfig.mallLogin);
              //         return ;
              //       }
              //       ProductEntity model = ProductEntity(
              //         itemNumId: goodsJson['default_item_num_id'],
              //         itemName: goodsJson['title'],
              //         ecShopNumId: goodsJson['shop_num_id'],
              //         price: double.parse(priceStr),
              //         marketPrice: double.parse(goodsJson['mkt_price'].toString()),
              //         commissionRatio: 0.0,
              //         commissionAmount: goodsJson['commission_amount'],
              //         imageSrc: goodsJson['image_default_id'],
              //         ecStyleNumId: goodsJson['ec_style_num_id'],
              //         styleNumId: goodsJson['style_num_id'],
              //         listImage: '',
              //         store: goodsJson['style_store'],
              //         favoriteSign: 0,
              //         distributionCommissionSign: 0,
              //         soldQuantity: double.parse(goodsJson['sold_quantity'].toString()),
              //         expectPrice: goodsJson['expect_price'],
              //         isSeckill: goodsJson['is_seckill'],
              //         isPreSale: goodsJson['is_pre_sale'],
              //       );
              //
              //       ShareDialogSheet.showShareDialog(context, model);
              //     },
              //     child: Padding(
              //       padding: EdgeInsets.only(right: 10, bottom: 45),
              //       child: Container(
              //         padding: EdgeInsets.all(4),
              //         child: Image.asset(
              //           "assets/images/share.png",
              //           width: 20,
              //           height: 20,
              //           color: Colors.red,
              //         ),
              //       ),
              //     ),
              //   ),
              // ),
              if (goodsJson['is_pre_sale'] != 1 && goodsJson['fresh_type'] != 8 )//商品列表中的加入购物车
                Align(
                  alignment: Alignment.bottomRight,
                  child: GestureDetector(
                    onTap: () {
                      if (SpUtil.getString('token') == null ||
                          SpUtil.getString('token') == '') {
                        Get.toNamed(RouteConfig.mallLogin);
                        return;
                      }
                      if (!soldOutBool) {
                        // String ecShopNumId =
                        //     SpUtil.getInt('storeShopNum')?.toString();
                        String ecShopNumId = goodsJson['shop_num_id']
                                ?.toString() ??
                            SpUtil.getObject(Config.GET_SHOP_INFO)['shop_id'];
                        String itemNumId =
                            goodsJson['default_item_num_id']?.toString();
                        String styleNumId =
                            goodsJson['style_num_id']?.toString();
                        String ecStyleNumId =
                            goodsJson['ec_style_num_id']?.toString();
                        logic.requestAddGoods(
                            ecShopNumId, itemNumId, styleNumId, ecStyleNumId);
                      }
                    },
                    child: Padding(
                      padding: const EdgeInsets.only(right: 12, bottom: 19),
                      child: Image.asset(
                        "assets/images/add_shopping_cart.png",
                        width: 24,
                        height: 24,
                        color: !soldOutBool
                            ? Color(0xffEA5504)
                            : Color(0xffcccccc),
                      ),
                    ),
                  ),
                ),

              Padding(
                padding: const EdgeInsets.only(left: 130, bottom: 22),
                child: Align(
                  alignment: Alignment.bottomLeft,
                  child: RichText(
                    text: TextSpan(children: _createPriceSpanList()),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.only(left: 130, bottom: 5),
                child: Align(
                    alignment: Alignment.bottomLeft,
                    child: Text(
                      "¥${goodsJson['mkt_price']}",
                      style: TextStyle(
                        fontSize: 12,
                        color: const Color(0xFFCCCCCC),
                        decoration: TextDecoration.lineThrough,
                      ),
                    )),
              ),
              Padding(
                padding: const EdgeInsets.only(left: 130),
                child:
                    Align(alignment: Alignment.bottomLeft, child: _divider()),
              ),
            ],
          )),
    );
  }
}
